{extend name='layouts/app'/}
{block name='content'}
<ul class="breadcrumb no-border no-radius b-b b-light pull-in">
    <li><a href="{:url('admin/index/index')}"><i class="fa fa-home"></i> 主页</a></li>
    <li class="active">会议管理</li>
</ul>
<div class="m-b-md">
    <h3 class="m-b-none">新增列表</h3>
</div>
<ul class="nav nav-tabs list-group">
    <li><a href="{:url('admin/meeting/index')}">会议列表</a></li>
    <li class="active"><a href="javascript:void(0);">新增会议</a></li>
</ul>
<section class="panel panel-default">
    <header class="panel-heading"> 新增会议</header>
    <div class="panel-body">
        <form class="form-horizontal" action="{:url('admin/meeting/store')}" method="post">
            <div class="form-group">
                <label class="col-sm-2 control-label">标题</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="name" placeholder="输入标题">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">副标题</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="subtitle" placeholder="输入副标题">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">缩略图</label>
                <div class="col-sm-10">
                    <div class="input-group">
                        <input type="hidden" class="form-control" name="thumb" readonly="" value="">
                        <div class="group-btn">
                            <button onclick="upImage(this)" class="btn btn-default" type="button">上传缩略图</button>
                        </div>
                    </div>
                    <div class="input-group" style="margin-top:5px;">
                        <img src="__STATIC__/admin/images/nopic.jpg" class="img-responsive img-thumbnail" width="150">
                        <em class="close" style="position:absolute; top: 0px; right: -14px;" title="删除这张图片" onclick="removeImg(this)">×</em>
                    </div>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">类型</label>
                <div class="col-sm-10">
                    <div class="radio">
                        <label class="radio-custom m-r-lg">
                            <input type="radio" name="type" value="0" checked="checked"><i class="fa fa-circle-o"></i> 国内会议
                        </label>
                        <label class="radio-custom">
                            <input type="radio" name="type" value="1"><i class="fa fa-circle-o"></i> 国外会议
                        </label>
                    </div>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">开始时间</label>
                <div class="col-sm-10">
                    <input type="text" class="input-s date_timepicker form-control" name="start_at" value="" placeholder="输入开课时间">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">结束时间</label>
                <div class="col-sm-10">
                    <input type="text" class="input-s date_timepicker form-control" name="end_at" value="" placeholder="输入开课时间">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">会议开始时间</label>
                <div class="col-sm-10">
                    <input type="text" class="input-s date_timepicker form-control" name="meeting_start_at" value="" placeholder="输入开课时间">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">会议结束时间</label>
                <div class="col-sm-10">
                    <input type="text" class="input-s date_timepicker form-control" name="meeting_end_at" value="" placeholder="输入开课时间">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">会议地址</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="address" placeholder="输入会议地址">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">排序</label>
                <div class="col-sm-10">
                    <input type="number" class="form-control" name="sort" value="100" placeholder="输入排序">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">状态</label>
                <div class="col-sm-10">
                    <div class="radio">
                        <label class="radio-custom m-r-lg">
                            <input type="radio" name="status" value="0" checked="checked"><i class="fa fa-circle-o"></i> 开启
                        </label>
                        <label class="radio-custom">
                            <input type="radio" name="status" value="1"><i class="fa fa-circle-o"></i> 关闭
                        </label>
                    </div>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">会议描述</label>
                <div class="col-sm-10">
                    <textarea id="contents" name="abstract" style="width:100%;height:400px;max-height:400px;" placeholder="会议描述"></textarea>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-2">
                    <button type="submit" class="btn btn-primary">新增</button>
                </div>
            </div>
        </form>
    </div>
</section>
{/block}
{block name='script'}
<script type="text/javascript">
    //上传图片
    function upImage(obj) {
        require(['util'], function (util) {
            options = {
                multiple: false,//是否允许多图上传
                //data是向后台服务器提交的POST数据
                data: {name: '图片', year: 2099},
            };

            util.image(function (images) {
                //上传成功的图片，数组类型
                $("[name='thumb']").val(images[0]);
                $(".img-thumbnail").attr('src', images[0]);
            }, options)
        });
    }

    //移除图片
    function removeImg(obj) {
        $(obj).prev('img').attr('src', "__STATIC__/admin/images/nopic.jpg");
        $(obj).parent().prev().find('input').val('');
    }

    //日期时间
    require(['util', 'jquery'], function (util, jQuery) {
        util.datetimepicker({
            //标签元素
            element: ".date_timepicker"
        });
    });

    //百度编辑器
    require(['util'], function (util) {
        util.ueditor('contents', {hash: 1, data: 'lamp'}, function (editor) {
            //这是回调函数 editor是百度编辑器实例
        });
    });
</script>
{/block}